package cn.iocoder.yudao.module.member.dal.mysql.jobView;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.dal.dataobject.jobView.JobViewDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.jobView.vo.*;

/**
 * 职位浏览记录 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface JobViewMapper extends BaseMapperX<JobViewDO> {

    default PageResult<JobViewDO> selectPage(JobViewPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<JobViewDO>()
                .eqIfPresent(JobViewDO::getStudentId, reqVO.getStudentId())
                .eqIfPresent(JobViewDO::getCompanyId, reqVO.getCompanyId())
                .eqIfPresent(JobViewDO::getJobId, reqVO.getJobId())
                .betweenIfPresent(JobViewDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(JobViewDO::getId));
    }

    default List<JobViewDO> selectList(JobViewExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<JobViewDO>()
                .eqIfPresent(JobViewDO::getStudentId, reqVO.getStudentId())
                .eqIfPresent(JobViewDO::getCompanyId, reqVO.getCompanyId())
                .eqIfPresent(JobViewDO::getJobId, reqVO.getJobId())
                .betweenIfPresent(JobViewDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(JobViewDO::getId));
    }

}
